<?php 
//all the class/function includes are managed in the includer file
include("include/includer.php");

//get all the configuration variables (custom function in newzbook.php include)
getConfigVars();  

//if the form was just posted back, let's use the form variables - otherwise the ones above will be used
if(isset($_POST['newzbin_name'])){
    $config_newzuname = $_POST['newzbin_name'];
}
if(isset($_POST['newzbin_pass'])){
    if($_POST['newzbin_pass'] != ""){
        $config_newzpw = $_POST['newzbin_pass'];
    }
}
if(isset($_POST['NZBDropPath'])){
    $config_NZBDropPath = $_POST['NZBDropPath'];
}
if(isset($_POST['deleteupondl'])){
    $config_deleteupondl = $_POST['deleteupondl'];
}
if(isset($_POST['NZBgetAppPath'])){
    $config_NZBgetAppPath = $_POST['NZBgetAppPath'];
}
if(isset($_POST['NZBgetConfigPath'])){
    $config_NZBgetConfigPath = $_POST['NZBgetConfigPath'];
}
if(isset($_POST['enablenzbget'])){
    $config_enablenzbget = $_POST['enablenzbget'];
}
if(isset($_POST['enablehistorydisp'])){
    $config_enablehistorydisp = $_POST['enablehistorydisp'];
}
if(isset($_POST['enablepostprocdisp'])){
    $config_enablepostprocdisp = $_POST['enablepostprocdisp'];
}
if(isset($_POST['nzbgetDLdetails'])){
    $config_nzbgetDLdetails = $_POST['nzbgetDLdetails'];
}
if(isset($_POST['nzbgetautorefresh'])){
    $config_nzbgetautorefresh = $_POST['nzbgetautorefresh'];
}
if(isset($_POST['inet_password'])){
    if($_POST['inet_password'] != ""){
        $config_inet_password = $_POST['inet_password'];
    }
}
if(isset($_POST['inet_protection'])){
    $config_inet_protection = $_POST['inet_protection'];
}
if(isset($_POST['memory_limit'])){
    $config_memory_limit = $_POST['memory_limit'];
}
if(isset($_POST['filemandefaultpath'])){
    $config_filemandefaultpath = $_POST['filemandefaultpath'];
}
if(isset($_POST['remoteplay'])){
    $config_remoteplay = $_POST['remoteplay'];
}
if(isset($_POST['theme_default'])){
    $config_theme_local = $_POST['theme_default'];
}
if(isset($_POST['theme_mobile'])){
    $config_theme_local = $_POST['theme_mobile'];
}
if(isset($_POST['theme_local'])){
    $config_theme_local = $_POST['theme_local'];
}
if(isset($_GET['action'])){
    $action = $_GET['action'];
}
if(isset($_GET['addsearchhelp'])){
    $addsearchhelp = $_GET['addsearchhelp'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<HEAD>
    <?php standardHead("Configuration"); ?>
</HEAD>

<BODY>
<?php internetSecurity(); ?>
<div style="visibility:hidden;display:none;" id="progress"><div id="progress_bg"></div><a name="loading" /><div id="progress_box"><img id="progress_image" style="padding-left:5px;padding-top:5px;" src="images/ajax-loader.gif" alt="loading...">You request is being processed...</div></div>
<div class="headercontent">
  <?php headerContent(); ?>
</div>
<div class="maincontent">
<?php
    
    if(!is_dir($config_NZBDropPath)) {
      echo "<div class='warningmessage'>The NZB Drop Path directory does not appear to exist. Try a default configuration.</div>";
    }
    
    if($config_enablenzbget == "enable"){
        if(isset($config_NZBgetAppPath) && isset($config_NZBgetConfigPath)){
          if(!is_dir($config_NZBgetAppPath)) {
              echo "<div class='warningmessage'>The NZBGet Application directory does not appear to exist. Try a default configuration or <form action='configuration.php' method='post' style='display:inline;'><input type='hidden' name='configset' value='true'><input type='hidden' name='enablenzbget' value='disable'><input type='submit' value='Disable NZBget integration' class='linkbutton'></form>.</div>";
              }
          if(!is_dir($config_NZBgetConfigPath)){
              echo "<div class='warningmessage'>The NZBGet Configuration directory does not appear to exist. Try a default configuration or <form action='configuration.php' method='post' style='display:inline;'><input type='hidden' name='configset' value='true'><input type='hidden' name='enablenzbget' value='disable'><input type='submit' value='Disable NZBget integration' class='linkbutton'></form>.</div>";
              }
        }
    }  
        echo "<br />Try one of the default configurations:
        <form action='configuration.php' method='post' style='display:inline;'>
        <input type='hidden' name='NZBDropPath' value='/share/.nzbget/nzb'>
        <input type='hidden' name='NZBgetConfigPath' value='/share/.nzbget'>
        <input type='hidden' name='NZBgetAppPath' value='/mnt/syb8634/bin'>
        <input type='hidden' name='configset' value='true'>
        <input type='submit' value='A110' style='width:50px;'>
        </form>
        <form action='configuration.php' method='post' style='display:inline;'>
        <input type='hidden' name='NZBDropPath' value='/share/.nzbget/nzb'>
        <input type='hidden' name='NZBgetConfigPath' value='/share/.nzbget'>
        <input type='hidden' name='NZBgetAppPath' value='/nmt/apps/bin'>
        <input type='hidden' name='configset' value='true'>
        <input type='submit' value='C200' style='width:50px;'>
        </form>
        <form action='configuration.php' method='post' style='display:inline;'>
        <input type='hidden' name='NZBDropPath' value='/share/Apps/NZBget/.nzbget/nzb'>
        <input type='hidden' name='NZBgetConfigPath' value='/share/Apps/NZBget/.nzbget'>
        <input type='hidden' name='NZBgetAppPath' value='/share/Apps/NZBget/bin'>
        <input type='hidden' name='configset' value='true'>
        <input type='submit' value='CSI' style='width:50px;'>
        </form>";
//check for a new version
echo checkNewzBookVersion();

echo "<br />";
        
        //then get the variables (then save them)
        if(isset($_POST['newzbin_name'])){
            $cfg->setValue("Newzbin","username", $_POST['newzbin_name']);
            //echo "Set the username. ";
        }
        if(isset($_POST['newzbin_pass'])){
            if($_POST['newzbin_pass']!=NULL && $_POST['newzbin_pass']!=""){
                $cfg->setValue("Newzbin","password", $_POST['newzbin_pass']);
                //echo "Set the password. ";
            }
        }
        if(isset($_POST['NZBDropPath'])){
            $cfg->setValue("Newzbin","NZBDropPath", $_POST['NZBDropPath']);
            //echo "Set the Drop Path. ";
        }
        if(isset($_POST['deleteupondl'])){
            $cfg->setValue("Newzbin","deleteupondl", $_POST['deleteupondl']);
            //echo "Set the Delete setting. ";
        }
        if(isset($_POST['enablenzbget'])){
            $cfg->setValue("NZBget","enablenzbget", $_POST['enablenzbget']);
            //echo "Set the password. ";
        }
        if(isset($_POST['NZBgetAppPath'])){
            $cfg->setValue("NZBget","NZBgetAppPath", $_POST['NZBgetAppPath']);
            //echo "Set the Drop Path. ";
        }
        if(isset($_POST['NZBgetConfigPath'])){
            $cfg->setValue("NZBget","NZBgetConfigPath", $_POST['NZBgetConfigPath']);
            //echo "Set the Delete setting. ";
        }
        if(isset($_POST['enablepostprocdisp'])){
            $cfg->setValue("NZBget","enablepostprocdisp", $_POST['enablepostprocdisp']);
        }
        if(isset($_POST['enablehistorydisp'])){
            $cfg->setValue("NZBget","enablehistorydisp", $_POST['enablehistorydisp']);
        }
        if(isset($_POST['nzbgetDLdetails'])){
            $cfg->setValue("NZBget","nzbgetDLdetails", $_POST['nzbgetDLdetails']);
        }
        if(isset($_POST['nzbgetautorefresh'])){
            $cfg->setValue("NZBget","nzbgetautorefresh", $_POST['nzbgetautorefresh']);
        }
        if(isset($_POST['inet_protection'])){
            $cfg->setValue("Internet Security","inet_protection", $_POST['inet_protection']);
        }
        if(isset($_POST['inet_password'])){
            if($_POST['inet_password']!=NULL && $_POST['inet_password']!=""){
                $cfg->setValue("Internet Security","inet_password", sha1($_POST['inet_password']));
            }
        }
        if(isset($_POST['memory_limit'])){
            $cfg->setValue("System","memory_limit", $_POST['memory_limit']);
        }
        if(isset($_POST['filemandefaultpath'])){
            $cfg->setValue("Fileman","defaultpath", $_POST['filemandefaultpath']);
        }
        if(isset($_POST['remoteplay'])){
            $cfg->setValue("Fileman","remoteplay", $_POST['remoteplay']);
        }
        if(isset($_POST['theme_default'])){
            $cfg->setValue("Themes","default", $_POST['theme_default']);
        }
        if(isset($_POST['theme_mobile'])){
            $cfg->setValue("Themes","mobile", $_POST['theme_mobile']);
        }
        if(isset($_POST['theme_local'])){
            $cfg->setValue("Themes","local", $_POST['theme_local']);
        }
        if(isset($_POST['configset'])){
            $configset = $_POST['configset'];
        }
        //else { echo "<div class='warningmessage'>Password not set!</div>"; }
        if($cfg->save() && $configset) { echo "<div class='infomessage'>Configuration file successfully saved!</div>"; }
        elseif($cfg->save() == false) { echo "<div class='warningmessage'>Configuration file could not be written to. Check the file/folder permissions.</div>"; }
?>
  <div class="block-outlined">
    <h2>General Configuration</h2>
    <form action="configuration.php" method="post">
    <div class="fielddesc">Newzbin Username:</div><input type="text" name="newzbin_name" id="newzbin_name" value="<?php echo $config_newzuname; ?>"/>
    <br />
    <div class="fielddesc">Newzbin Password:</div><input type="password" name="newzbin_pass" id="newzbin_pass"/>
    <?php
    if(isset($config_newzpw) && $config_newzpw != ""){ echo "[<font color='green'>Set</font>]"; } else{ echo "[<font color='red'>Not Set</font>]";}
    ?>
    <br />
    <div class="fielddesc">NZB Drop Path:</div><input type="text" name="NZBDropPath" id="NZBDropPath" value="<?php echo $config_NZBDropPath; ?>"/>
    <?php echo "[".substr(sprintf('%o', fileperms($config_NZBDropPath)), -4)."]"; ?> 
    <br />
    <div class="fielddesc">Delete bookmark(s):</div><input type="radio" name="deleteupondl" Value="delon" <?php if($config_deleteupondl == "delon"){echo "checked";}?>>Yes</input><input type="radio" name="deleteupondl" Value="deloff" <?php if($config_deleteupondl == "deloff"){echo "checked";}?>>No</input>
  <!--
  </div>
  <div class="block-outlined">
  -->
  <br /><br />
    <h2>NZBget Configuration</h2>
    <div class="fielddesc">Enable NZBget integration:</div><input type="radio" name="enablenzbget" Value="enable" <?php if($config_enablenzbget == "enable"){echo "checked";}?>>Enable</input><input type="radio" name="enablenzbget" Value="disable" <?php if($config_enablenzbget == "disable"){echo "checked";}?>>Disable</input>
    <br />
    <div class="fielddesc">Application Path:</div><input type="text" name="NZBgetAppPath" id="NZBgetAppPath" value="<?php echo $config_NZBgetAppPath; ?>"/>/nzbget
    <?php echo "[".substr(sprintf('%o', fileperms($config_NZBgetAppPath."/nzbget")), -4)."]"; ?>
    <br />
    <div class="fielddesc">Configuration Path:</div><input type="text" name="NZBgetConfigPath" id="NZBgetConfigPath" value="<?php echo $config_NZBgetConfigPath; ?>"/>/nzbget.conf
    <?php echo "[".substr(sprintf('%o', fileperms($config_NZBgetConfigPath."/nzbget.conf")), -4)."]"; ?>
    <br />
    <div class="fielddesc">History Section:</div><input type="radio" name="enablehistorydisp" Value="enable" <?php if($config_enablehistorydisp == "enable"){echo "checked";}?>>Enable</input><input type="radio" name="enablehistorydisp" Value="disable" <?php if($config_enablehistorydisp == "disable"){echo "checked";}?>>Disable</input>
    <br />
    <div class="fielddesc">Post-processing section:</div><input type="radio" name="enablepostprocdisp" Value="enable" <?php if($config_enablepostprocdisp == "enable"){echo "checked";}?>>Enable</input><input type="radio" name="enablepostprocdisp" Value="disable" <?php if($config_enablepostprocdisp == "disable"){echo "checked";}?>>Disable</input>
    <br />
    <div class="fielddesc">Show download details:</div><input type="radio" name="nzbgetDLdetails" Value="enable" <?php if($config_nzbgetDLdetails == "enable"){echo "checked";}?>>Enable</input><input type="radio" name="nzbgetDLdetails" Value="disable" <?php if($config_nzbgetDLdetails == "disable"){echo "checked";}?>>Disable</input>
    <br />
    <div class="fielddesc">Auto-refresh:</div><input type="radio" name="nzbgetautorefresh" Value="enable" <?php if($config_nzbgetautorefresh == "enable"){echo "checked";}?>>Enable</input><input type="radio" name="nzbgetautorefresh" Value="disable" <?php if($config_nzbgetautorefresh == "disable"){echo "checked";}?>>Disable</input>
  <!--
  </div>
  <div class="block-outlined">
  -->
  <br /><br />
    <h2>System Wide Settings</h2>
    <div class="fielddesc">Secure from Internet:</div><input type="radio" name="inet_protection" Value="enable" <?php if($config_inet_protection == "enable"){echo "checked";}?>>Enable</input><input type="radio" name="inet_protection" Value="disable" <?php if($config_inet_protection == "disable"){echo "checked";}?>>Disable</input>
    <br />
    <div class="fielddesc">Internet Password:</div><input type="password" name="inet_password" id="inet_password"/>
    <?php
    if(isset($config_inet_password) && $config_inet_password != ""){ echo "[<font color='green'>Set</font>]"; } else{ echo "[<font color='red'>Not Set</font>]";}
    echo "<br />";
    ?>
    <!-- <h2>System Settings</h2> -->
    <div class="fielddesc">Override Max Memory:</div>
    <select name="memory_limit">
      <option value="16M" <?php if($config_memory_limit == "16M"){ echo "SELECTED";} ?>>16 MB</option>
      <option value="32M" <?php if($config_memory_limit == "32M"){ echo "SELECTED";} ?>>32 MB</option>
      <option value="64M" <?php if($config_memory_limit == "64M"){ echo "SELECTED";} ?>>64 MB</option>
      <option value="128M"<?php if($config_memory_limit == "128M"){ echo "SELECTED";} ?>>128 MB</option>
    </select>
    <br />
    <div class='fielddesc'>Default Theme:</div>
    <select name='theme_default'>
    <?php
    //loop through the styles folder looking for CSS files and show them as a drop-down list of themes
    $dirlist = scandir('./style');
    foreach($dirlist as $item){
        //get the file extension type
        $ext = strtolower(pathinfo($item, PATHINFO_EXTENSION));
        //only show it if it's CSS
        if($ext == "css"){
            if($config_theme_default == $item){ $selected = "SELECTED"; }
            else{ $selected = ""; }
            //trim out the extension
            $itemClean = str_ireplace(".css","",$item);
            echo "<option value='$item' $selected>$itemClean</option>";
        }
    }
    ?>
    </select><br />
    <div class='fielddesc'>Mobile Theme:</div>
    <select name='theme_mobile'>
    <?php
    //loop through the styles folder looking for CSS files and show them as a drop-down list of themes
    $dirlist = scandir('./style');
    foreach($dirlist as $item){
        //get the file extension type
        $ext = strtolower(pathinfo($item, PATHINFO_EXTENSION));
        //only show it if it's CSS
        if($ext == "css"){
            if($config_theme_mobile == $item){ $selected = "SELECTED"; }
            else{ $selected = ""; }
            //trim out the extension
            $itemClean = str_ireplace(".css","",$item);
            echo "<option value='$item' $selected>$itemClean</option>";
        }
    }
    ?>
    </select><br />
    <div class='fielddesc'>Local Access (PCH) Theme:</div>
    <select name='theme_local'>
    <?php
    //loop through the styles folder looking for CSS files and show them as a drop-down list of themes
    $dirlist = scandir('./style');
    foreach($dirlist as $item){
        //get the file extension type
        $ext = strtolower(pathinfo($item, PATHINFO_EXTENSION));
        //only show it if it's CSS
        if($ext == "css"){
            if($config_theme_local == $item){ $selected = "SELECTED"; }
            else{ $selected = ""; }
            //trim out the extension
            $itemClean = str_ireplace(".css","",$item);
            echo "<option value='$item' $selected>$itemClean</option>";
        }
    }
    ?>
    </select>
    <br />
    <br />
    
    <h2>File Manager Settings</h2>
    <div class="fielddesc">Default (start) path:</div><input type='text' name='filemandefaultpath' value='<?php echo $config_filemandefaultpath; ?>'/>
    <?php echo "[".substr(sprintf('%o', fileperms($config_filemandefaultpath)), -4)."]"; ?>
    <br />
    <div class="fielddesc">Remote Play</div><input type="radio" name="remoteplay" Value="enable" <?php if($config_remoteplay == "enable"){echo "checked";}?>>Enable</input><input type="radio" name="remoteplay" Value="disable" <?php if($config_remoteplay == "disable"){echo "checked";}?>>Disable</input>
    <br />
    
    <br />
    <input type="hidden" name="configset" id="configset" value="true"/>
    <br /><input type="submit" value="Save" onclick="return loadSubmit()"/>
    </form>
  </div>
  <div class="block-outlined">
  <!-- SYSTEM GENERATED HASH-->
  <?php
  echo "<h2>Internet Hash</h2>";
  echo "The internet hash is used for external functions that need to access NewzBook when it is secured. For example, the built in MP3 Playlist function will attempt to use the hash when required.  Please note that if you clear the hash or generate a new hash, the external functions that depend on this feature will need to be updated in order to work. Also, if you do not use any external functions (including the MP3 playlists), you can clear the hash to increase security.<br /><br />";
  //if the user requested a new hash, generate it, save it, and display it
  //check if the variable is set and if so create a local variable
  if(isset($_POST['generatehash'])){
      //get the variable
      if($_POST['generatehash'] == "enable"){
          //set the app variable
          $generatehash = "enable";
      }
  }
  
  //check if the variable is set and if so create a local variable
  if(isset($_POST['clearhash'])){
      //get the variable
      if($_POST['clearhash'] == "enable"){
          //set the app variable
          $clearhash = "enable";
      }
  }
  
  //if the user requested a new hash, let's make it
  if($generatehash == "enable"){
      //generate a new random sha1 hash
      $config_inet_hash = sha1(uniqid(rand(), true));
      //now let's save it
      $cfg->setValue("Internet Security","inet_hash", $config_inet_hash);
      if($cfg->save()) { echo "<div class='infomessage'>Configuration file successfully updated!</div>"; }
      elseif($cfg->save() == false) { echo "<div class='warningmessage'>Configuration file could not be written to. Check the file/folder permissions.</div>"; }
  }
  
  //if the user asked us to clear the hash, let's do it
  if($clearhash == "enable"){
      $cfg->setValue("Internet Security","inet_hash", null);
      if($cfg->save()) { echo "<div class='infomessage'>Configuration file successfully updated!</div>"; }
      elseif($cfg->save() == false) { echo "<div class='warningmessage'>Configuration file could not be written to. Check the file/folder permissions.</div>"; }
      $config_inet_hash = null;
  }
  
  //let's display the hash we have on file
  echo "<div class='fielddesc'>Access Hash:</div>";
  if($config_inet_hash != null){
      echo "<font color='green'>$config_inet_hash</font>";
  }
  else{
      echo "<font color='red'>Hash does not exist</font>";
  }
  echo "<br />";
  
  //let's create the button for generating a new hash or clearing the existing one
  echo " <form action='configuration.php' method='post' style='display:inline;'><input type='hidden' name='generatehash' value='enable'><input type='submit' value='Generate Hash'></form>";
  echo " <form action='configuration.php' method='post' style='display:inline;'><input type='hidden' name='clearhash' value='enable'><input type='submit' value='Clear Hash'></form>";
  ?>
  </div>
  <div class="block-outlined">
  <h2>Newzbin.com Custom Searches</h2>
  <a name="customsearches"/>
  By default, the search tab only contains the out of the box Newzbin searches. If you have created custom / saved searches on Newzbin, you can add them to NewzBook.<br /><br />
  <?php 
  //format the saved search variables and display a success message
  if(isset($_GET['searchID'])){
      $searchID = $_GET['searchID'];
  }
  if(isset($_GET['searchname'])){
      $searchname = $_GET['searchname'];
  }
  //if one item is set, the other needs to be set too
  if(($searchID != null && $searchname == null) || ($searchID == null && $searchname != null)){
      echo "<div class='warningmessage'>You must set both fields: Saved Search ID and Search Name</div>";
  }
  //if both items aren't null, let's add it to the configuration
  if($searchID != null && $searchname != null){
      //make sure the item isn't already in the list
      if(strpos($config_saved_searches, $searchID) !== false){
          echo "<div class='warningmessage'>The Saved Search ID \"$searchID\" already exists at character position ".strpos($config_saved_searches, $searchID).".</div>";
      }
      else{
          //if there are items already, we need the comma (otherwise we don't)
          if($config_saved_searches != ""){
              $config_saved_searches = $config_saved_searches.",";
          }
          //append the new item to the end
          $config_saved_searches = $config_saved_searches.inistringclean($searchID).":".inistringclean($searchname);
          //save the configuration
          $cfg->setValue("Newzbin","savedsearches", $config_saved_searches);
          if($cfg->save()) { echo "<div class='infomessage'>Configuration file successfully updated!</div>"; }
          else{ echo "<div class='warningmessage'>Configuration file could not be written to. Check the file/folder permissions.</div>"; }
      }
  }
  
  //setup the delete action
  if($action == "deletesavedsearch" && $_GET['ss_id'] != ""){
      //loop through the existing configuration and remove the line that contains the searchID we are looking for
      $savedsearches = explode(",",$config_saved_searches);
      $config_saved_searches = "";
      foreach($savedsearches as $search){
          if(strpos($search, $_GET['ss_id']) !== false){
              //if there's a match, we aren't going to add it to the new config line to be saved
          }
          //if there's not a match, let's make sure it get's added back
          else{
              //if it's not the first value, we need to comma separate it
              if($config_saved_searches != ""){
                  $config_saved_searches .= ",".$search;
              }
              //otherwise just add it to the variable
              else{
                  $config_saved_searches .= $search;
              }
          }
      }
      
      //save the configuration
      $cfg->setValue("Newzbin","savedsearches", $config_saved_searches);
      if($cfg->save()) { echo "<div class='infomessage'>Configuration file successfully updated!</div>"; }
      else{ echo "<div class='warningmessage'>Configuration file could not be written to. Check the file/folder permissions.</div>"; }
  }
  
  //turn the configuration file into something useful (only if it's being used)
  if($config_saved_searches != ""){
      echo "<div class='indent'>";
      $savedsearches = explode(",",$config_saved_searches);
      $num = 1;
      foreach($savedsearches as $search){
          list($searchID, $searchname) = explode(":",$search);
          echo "<strong><a href='?action=deletesavedsearch&ss_id=$searchID'><img src='images/delete.png'/></a>Saved Search #$num</strong>: $searchID, $searchname<br />";
          $num++;
      }
      echo "</div>";
  }
  else{
    echo "<i>You don't have any Newzbin Saved Searches in your configuration.</i><br />";
  }
  
  //if the user wants to add a saved search, let's give them a form to do it with
  if($action == "addsavedsearch"){
      echo "<div class='highlight'>";
      echo "<form>";
      echo "Saved Search ID: <input type='text' name='searchID'> ";
      echo "Search Name: <input type='text' name='searchname'>";
      echo "<input type='submit' value='Add'/>";
      echo " <a href='?action=addsavedsearch&addsearchhelp=yes#customsearches'><img src='images/help.png'/></a>";
      echo "</form>";
      echo "</div>";
  }
  if($addsearchhelp == "yes"){
      echo "<br /><div class='infomessage'>There are two items we need to add a Saved Search: <br />
            <strong>(1) Saved Search ID:</strong> This is typically a 6 digit ID that you can find in the URL when editing a saved search. It's the number that follows the \"ss=\" or \"ss_id=\"<br />
            <strong>(2) Saved Search Name:</strong> This is the name that will show up in the search drop down. You can call this search whatever you want within NewzBook.<br />
            </div>";
  }
  ?>
  <br />
  <a href='?action=addsavedsearch#customsearches'><img src='images/add.png'/>Add a Saved Search</a>
  </div>
<?php if($config_newzuname == "" || $config_newzpw == ""){ die("<div class='warningmessage'>Username and/or password are not set.</div>"); }?>
<?php
function inistringclean($configline){
    $from = array("(",")","{","}","[","]","&","!","$",";","\"","~");
    $to = array("- ","","- ","","- ","","+","","","","'","");
    $configline = str_replace($from, $to, $configline, $count);
    //echo "| Count: $count |";
    return $configline;
}
?>
</div>
<div class='footercontent'>
<a href='debug.php'>Debug Page</a>
</div>
</BODY>